package sbe.sonar.client.database;

import java.io.Serializable;

import javax.persistence.*;

import java.util.List;


/**
 * The persistent class for the Module database table.
 * 
 */
@Entity
@Table(name="Module", schema="SVNApplications")
@NamedQuery(name="Module.findAll", query="SELECT m FROM Module m")
public class Module implements Serializable {
	private static final long serialVersionUID = 1L;
	private String idModule;
	private String artifactId;
	private String regularExpression;
	private String sonarKey;
	private String sourcePath;
	private List<ModulesByApplication> modulesByApplications;
	private List<Application> applications;

	public Module() {
	}


	@Id
	public String getIdModule() {
		return this.idModule;
	}

	public void setIdModule(String idModule) {
		this.idModule = idModule;
	}


	public String getArtifactId() {
		return this.artifactId;
	}

	public void setArtifactId(String artifactId) {
		this.artifactId = artifactId;
	}


	public String getRegularExpression() {
		return this.regularExpression;
	}

	public void setRegularExpression(String regularExpression) {
		this.regularExpression = regularExpression;
	}


	public String getSonarKey() {
		return this.sonarKey;
	}

	public void setSonarKey(String sonarKey) {
		this.sonarKey = sonarKey;
	}


	public String getSourcePath() {
		return this.sourcePath;
	}

	public void setSourcePath(String sourcePath) {
		this.sourcePath = sourcePath;
	}


	//bi-directional many-to-one association to ModulesByApplication
	@OneToMany(mappedBy="module", fetch=FetchType.EAGER)
	public List<ModulesByApplication> getModulesByApplications() {
		return this.modulesByApplications;
	}

	public void setModulesByApplications(List<ModulesByApplication> modulesByApplications) {
		this.modulesByApplications = modulesByApplications;
	}

	public ModulesByApplication addModulesByApplication(ModulesByApplication modulesByApplication) {
		getModulesByApplications().add(modulesByApplication);
		modulesByApplication.setModule(this);

		return modulesByApplication;
	}

	public ModulesByApplication removeModulesByApplication(ModulesByApplication modulesByApplication) {
		getModulesByApplications().remove(modulesByApplication);
		modulesByApplication.setModule(null);

		return modulesByApplication;
	}


	//bi-directional many-to-many association to Application
	@ManyToMany(mappedBy="modules", fetch=FetchType.EAGER)
	public List<Application> getApplications() {
		return this.applications;
	}

	public void setApplications(List<Application> applications) {
		this.applications = applications;
	}

}